import { defineStore } from 'pinia';

export default function (option) {
  return defineStore({
    actions: {
      setData(data) {
        Object.entries(data).forEach(([k, v]) => {
          this[k] = v;
        });
      }
    },

    persist: {
      enabled: true,
      strategies: [
        {
          storage: sessionStorage,
        },
      ],
    },

    ...option
  });
};
